#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int length;

void ff(int n, int m, int *flag) {
	if (n < 1 || m < 1)
		return;
	if (n > m)
		n = m;
	if (n == m) {
		if (n != length)
			printf("\n");
		flag[n - 1] = 1;
		for (int i = length - 1, j = 0; i >= 0; i--)
			if (flag[i] == 1) {
				printf(j == 0 ? "%d" : " %d", i + 1);
				j = 1;
			}
		printf("\n");
		flag[n - 1] = 0;
	}
	flag[n - 1] = 1;
	ff(n - 1, m - n, flag);
	flag[n - 1] = 0;
	ff(n - 1, m, flag);
}

int main() {
	int m;
	scanf("%d", &m);
	length = m;
	int *flag = (int *)malloc(sizeof(int) * m);
	ff(m, m, flag);
	free(flag);
	return 0;
}